import { configureStore } from "@reduxjs/toolkit";
import countReducer from "./demo/count";
import todoListReducer, { TodoItemType } from "./demo/todoList";
import user, { UserStateType } from "./user";

import componentReducer, { ComponentStateType, ComponentType } from "./componentReducer";

export type StateType = {
  count: number;
  todoList: TodoItemType[];
  components: ComponentStateType;
  user: UserStateType;
};

const store = configureStore({
  reducer: {
    count: countReducer,
    todoList: todoListReducer,
    // 扩展其他模块
    components: componentReducer,
    user,
  },
});
export type AppDispatch = typeof store.dispatch;
export default store;

export type { ComponentStateType, ComponentType };
